Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(foundry-ignore-compile): read from ignore file and filter out al… #1

Open
wants to merge 4 commits into
base: feature/foundry-ignore-compile
Choose a base branch
from

Conversation

tringuyenskymavis
Copy link

Description

This PR adds a feature to allow ignoring all paths specified in the foundry_ignore file when running forge build.

Copy link

@nxqbao nxqbao left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please apply current rustfmt.toml

let foundry_ignored_paths: Vec<String> = self.get_ignore_paths()?;

if foundry_ignored_paths.is_empty() {
println!("No ignored paths found");
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prefer use warning here

Comment on lines 838 to 851
let foundry_ignored_paths: Vec<String> = self.get_ignore_paths()?;

if foundry_ignored_paths.is_empty() {
println!("No ignored paths found");
}

let ignore_pattern: Vec<GlobMatcher> = foundry_ignored_paths
.iter()
.filter_map(|path| GlobMatcher::from_str(path).ok())
.collect();

let ignore_filter: SkipBuildFilters =
SkipBuildFilters::new(ignore_pattern.clone(), self.root.0.clone());
builder = builder.sparse_output(ignore_filter);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Group these lines in to a fn

let foundry_ignored_paths: Vec<String> = self.get_ignore_paths()?;

if foundry_ignored_paths.is_empty() {
println!("No ignored paths found");
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
println!("No ignored paths found");
println!("No skipped paths found in .foundryignore");


let ignore_filter: SkipBuildFilters =
SkipBuildFilters::new(ignore_pattern.clone(), self.root.0.clone());
builder = builder.sparse_output(ignore_filter);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
builder = builder.sparse_output(ignore_filter);
builder = builder.sparse_output(ignore_filter);

Comment on lines 1084 to 1086
if !path.exists() {
return Ok(Vec::new());
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Return more clear error, to differentiate "file not found", and "file not contains items"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants